#include <stdio.h>

int main(int argc, char const *argv[])
{
    if( argc != 2 )
    {
        printf("Pls input: ./a.out < dst file name>\n");
        return -1;
    }

    FILE *fpSrc = fopen(argv[1], "r");
    if( NULL == fpSrc )
    {
        printf("Fail to open file\n");        
    }

    char cBuffer[1024] = {0};
    fgets(cBuffer, sizeof(cBuffer), fpSrc);

    fclose(fpSrc);

    printf("Read from file %s to Buffer is:\n%s", argv[1], cBuffer);
     
    return 0;
}

/*
函数 fgets 
  每次从文件流中读取一个字符串.
  换行符 \n 也会读取到
  fgets函数在读取到的字符串最后加上 \0 
 

*/